(function () {
    "use strict";

    angular.module('core').factory('faturaPagarService', factory);
    factory.$inject = ['$http', '$q'];

    function factory($http, $q) {

        return {
            get: function (id) {
                var deferred = $q.defer();
                $http.post('/faturaPagar/get', id)
                    .success(function (data) { deferred.resolve(data); })
                    .error(function (data, status, headers, config) { deferred.reject(data); });
                return deferred.promise;
            },
            getAll: function (args) {
                var deferred = $q.defer();
                $http.post('/faturaPagar/getall', args)
                    .success(function (data) { deferred.resolve(data); })
                    .error(function (data, status, headers, config) { deferred.reject(data); });
                return deferred.promise;
            },
            count: function (args) {
                var deferred = $q.defer();
                $http.post('/faturaPagar/count', args)
                    .success(function (data) { deferred.resolve(data); })
                    .error(function (data, status, headers, config) { deferred.reject(data); });
                return deferred.promise;
            },

            getTituloPagar: function (id) {
                var args = { id: id };
                var deferred = $q.defer();
                $http.post('/faturaPagar/getTituloPagar', args)
                    .success(function (data) { deferred.resolve(data); })
                    .error(function (data, status, headers, config) { deferred.reject(data); });
                return deferred.promise;
            },
            getAllTituloPagar: function (args) {
                var deferred = $q.defer();
                $http.post('/faturaPagar/getAllTituloPagar', args)
                    .success(function (data) { deferred.resolve(data); })
                    .error(function (data, status, headers, config) { deferred.reject(data); });
                return deferred.promise;
            },
            countTituloPagar: function (args) {
                var deferred = $q.defer();
                $http.post('/faturaPagar/countTituloPagar', args)
                    .success(function (data) { deferred.resolve(data); })
                    .error(function (data, status, headers, config) { deferred.reject(data); });
                return deferred.promise;
            },
            totalizeTituloPagar: function (args) {
                var deferred = $q.defer();
                $http.post('/faturaPagar/totalizeTituloPagar', args)
                    .success(function (data) { deferred.resolve(data); })
                    .error(function (data, status, headers, config) { deferred.reject(data); });
                return deferred.promise;
            },

            getLiquidacaoTituloPagar: function (id) {
                var args = { id: id };
                var deferred = $q.defer();
                $http.post('/faturaPagar/getLiquidacaoTituloPagar', args)
                    .success(function (data) { deferred.resolve(data); })
                    .error(function (data, status, headers, config) { deferred.reject(data); });
                return deferred.promise;
            },
            getAllLiquidacaoTituloPagar: function (args) {
                var deferred = $q.defer();
                $http.post('/faturaPagar/getAllLiquidacaoTituloPagar', args)
                    .success(function (data) { deferred.resolve(data); })
                    .error(function (data, status, headers, config) { deferred.reject(data); });
                return deferred.promise;
            },
            countLiquidacaoTituloPagar: function (args) {
                var deferred = $q.defer();
                $http.post('/faturaPagar/countLiquidacaoTituloPagar', args)
                    .success(function (data) { deferred.resolve(data); })
                    .error(function (data, status, headers, config) { deferred.reject(data); });
                return deferred.promise;
            },

            prepareNew: function () {
                var deferred = $q.defer();
                $http.post('/faturaPagar/prepareNew')
                    .success(function (data) { deferred.resolve(data); })
                    .error(function (data, status, headers, config) { deferred.reject(data); });
                return deferred.promise;
            },
            prepare: function (item) {
                var deferred = $q.defer();
                $http.post('/faturaPagar/prepare', item)
                    .success(function (data) { deferred.resolve(data); })
                    .error(function (data, status, headers, config) { deferred.reject(data); });
                return deferred.promise;
            },

            prepareNewTituloPagar: function (item) {
                var deferred = $q.defer();
                $http.post('/faturaPagar/prepareNewTituloPagar', item)
                    .success(function (data) { deferred.resolve(data); })
                    .error(function (data, status, headers, config) { deferred.reject(data); });
                return deferred.promise;
            },
            prepareTituloPagar: function (item) {
                var deferred = $q.defer();
                $http.post('/faturaPagar/prepareTituloPagar', item)
                    .success(function (data) { deferred.resolve(data); })
                    .error(function (data, status, headers, config) { deferred.reject(data); });
                return deferred.promise;
            },

            prepareNewLiquidacaoTituloPagar: function (item) {
                var deferred = $q.defer();
                $http.post('/faturaPagar/prepareNewLiquidacaoTituloPagar', item)
                    .success(function (data) { deferred.resolve(data); })
                    .error(function (data, status, headers, config) { deferred.reject(data); });
                return deferred.promise;
            },
            prepareLiquidacaoTituloPagar: function (item) {
                var deferred = $q.defer();
                $http.post('/faturaPagar/prepareLiquidacaoTituloPagar', item)
                    .success(function (data) { deferred.resolve(data); })
                    .error(function (data, status, headers, config) { deferred.reject(data); });
                return deferred.promise;
            },

            save: function (item) {
                var deferred = $q.defer();
                $http.post('/faturaPagar/save', item)
                    .success(function (data) { deferred.resolve(data); })
                    .error(function (data, status, headers, config) { deferred.reject(data); });
                return deferred.promise;
            },
            delete: function (id) {
                var args = { id: id };
                var deferred = $q.defer();
                $http.post('/faturaPagar/delete', args)
                    .success(function (data) { deferred.resolve(data); })
                    .error(function (data, status, headers, config) { deferred.reject(data); });
                return deferred.promise;
            },

            saveTituloPagar: function (item) {
                var deferred = $q.defer();
                $http.post('/faturaPagar/saveTituloPagar', item)
                    .success(function (data) { deferred.resolve(data); })
                    .error(function (data, status, headers, config) { deferred.reject(data); });
                return deferred.promise;
            },
            deleteTituloPagar: function (id) {
                var args = { id: id };
                var deferred = $q.defer();
                $http.post('/faturaPagar/deleteTituloPagar', args)
                    .success(function (data) { deferred.resolve(data); })
                    .error(function (data, status, headers, config) { deferred.reject(data); });
                return deferred.promise;
            },
        };
    }

})();


